<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.util.ArrayList;" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src = "../js/jquery-1.12.1.js" type = "text/javascript"></script>
<script src="../js/echarts.min.js"></script>
</head>
<body>
<div class="page-container">
	<form id="SearchState" method="post">
		<div class="text-c"> 
			作业:
			<span class="select-box inline">
				<select class="select"  name="jobId" id="jobId">
					<option value="" selected="selected">第一章</option>
					<option value="">第二章</option>
					<option value="">第三章</option>
					<option value="">第四章</option>
					<option value="">第五章</option>
					<option value="">第六章</option>
				</select>
			</span>
			<input type="hidden" id="" name="">
			<button id="lookfor" type="button" class="btn btn-primary radius">查询</button>
		</div>
	</form>
</div>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="width: 600px;height:400px;"></div>
	<!--获取request域中参数-->
	<%
		ArrayList<Integer> listtest = (ArrayList<Integer>)request.getAttribute("list");
		String[] nametest = (String[])request.getAttribute("name");
		//System.out.println(nametest[0]);
	%>

    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        
    	var list=new Array();
    	var title=new Array();
		<%for(int i=0;i<listtest.size();i++){%>  
			list[<%=i%>]=<%=listtest.get(i)%>;
			document.write(list[<%=i%>]);
	 	<%}%>
	 	
	 	<%for(int i=0;i <nametest.length;i++){%>  
	 		title[<%=i%>]=" <%=nametest[i]%> ";
			document.write(title[<%=i%>]);
		<%}%>
        
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: 'ECharts rumen'
            },
            tooltip: {},
            legend: {
                data:['數量']
            },
            xAxis: {
                data: title
            },
            yAxis: {},
            series: [{
                name: '數量',
                type: 'bar',
                data: list
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>